package cn.b.sky.mes.pp.service.impl;

import java.util.ArrayList;
import java.util.List;

import cn.b.sky.mes.pp.dao.WOConfirmDao;
import cn.b.sky.mes.pp.model.ProOrderDetails;
import cn.b.sky.mes.pp.service.WOConfirmSeriver;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("wOConfirmSeriver")
public class WOConfirmServiceImpl implements WOConfirmSeriver {

  @Autowired
  private WOConfirmDao woConfirmDao;

  @Override
  public List<ProOrderDetails> selectProOrderDetailsByWorkCenter(String siteCode, String workCenterCode,
                                                                 Integer pageNum, Integer pageSize) {

    List<ProOrderDetails> list = new ArrayList<ProOrderDetails>();
    if (StringUtils.isBlank(siteCode) || StringUtils.isBlank(workCenterCode)) {
      //(暂时返回空列表) 如果需要 抛出  错误信息
      return list;
    }
    int startRow = 0;
    int endRow = 20;
    if (pageSize == null) {
      pageSize = 20;
    }
    if (pageNum != null && pageNum >= 1) {
      startRow = (pageNum - 1) * pageSize;
      endRow = startRow + pageSize * pageNum;
    }
    return woConfirmDao.selectProOrderDetailsByWorkCenter(siteCode, workCenterCode, startRow, endRow);
  }

}
